package model;

import java.io.Serializable;

/**
 * This class represents a user object.
 * 
 * @author Rylie Nelson, Eric Preston
 */
public class User implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 3095427379212036393L;

	/**
	 * The user's email will be used as an identifier for the user
	 */
	private String userName; 
	
	/**
	 * The user's unique id
	 */
	private int userID;
	
	/**
	 * The user's first name
	 */
	private String firstName;
	
	/**
	 * The user's last name
	 */
	private String lastName;
	
	/**
	 * The constructor for a user
	 * @param input_name the user's email address
	 * @param input_id the user's unique id
	 * @param input_first the first name of the user
	 * @param input_last the last name of the user
	 */
	public User(String input_name, int input_id,
		String input_first, String input_last) {
		userName = input_name;
		userID = input_id;
		firstName = input_first;
		lastName = input_last;
	}
	
	/**
	 * Returns the user's email address
	 * @return the user's email address
	 */
	public String getName() {
		return userName;
	}
	
	/**
	 * Returns a string representation of the user
	 * @return a string representation of the user
	 */
	public String toString() {
		return "Name: " + firstName + " " + lastName + "; " + "User ID: " + userID;
	}
	
	/**
	 * Used to compare an object and see if it equal to this user object.
	 */
	@Override
	public boolean equals(Object o) {
		if (!(o instanceof User)) 
			return false;
		
		User u = (User) o;
		if (u.userID == userID) {
			return true;
		} else {
			return false;
		}
	}
}
